home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / include / mg_xglP.h < prev    next >
C/C++ Source or Header  |  1992-01-30  |  3KB  |  89 lines

  1. /* Copyright (c) 1992 The Geometry Center; University of Minnesota
  2.    1300 South Second Street;  Minneapolis, MN  55454, USA;
  3.    
  4. This file is part of geomview/OOGL. geomview/OOGL is free software;
  5. you can redistribute it and/or modify it only under the terms given in
  6. the file COPYING, which you should have received along with this file.
  7. This and other related software may be obtained via anonymous ftp from
  8. geom.umn.edu; email: software@geom.umn.edu. */
  9.  
  10.  
  11. /* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */
  12.  
  13. #include "mgP.h"
  14. #include "mg_xgl.h"
  15.  
  16. #define _sys_varargs_h    /* Prevent including <varargs.h>! */
  17.  
  18. #undef __STDC__        /* Kludge around Sun "DOTDOTDOT" misdeclarations */
  19. #include <xview/xview.h>
  20. #include <xview/canvas.h>
  21. #include <xgl/xgl.h>
  22. #define __STDC__
  23.  
  24.  
  25. typedef struct mgxglcontext {
  26.     mgcontext     mgc;
  27.     int        born;
  28.  
  29.             /* XGL state data */
  30.     Xgl_3d_ctx    xglctx;        /* XGL context; == ctx_win or ctx_mem */
  31.     Xgl_win_ras xglwin;        /* XGL X11/XView window */
  32.     Xgl_mem_ras xglmem;        /* XGL memory raster, in case we need it */
  33.     Xgl_trans xglview;        /* Viewing (camera projection) transform */
  34.     Xgl_trans xglmodel;        /* Modelling transform */
  35.     Xgl_trans xglcam;        /* World-to-camera transform */
  36.     Xgl_cmap xglcmap;        /* XGL Colormap */
  37.  
  38.     Xgl_3d_ctx  ctx_win;    /* XGL 3D context for window */
  39.     Xgl_3d_ctx    ctx_mem;    /* XGL 3D context for memory raster (if any) */
  40.     void    *memras;    /* Memory area, in case we use mem raster */
  41.  
  42. #define MGXGL_MAXLIGHTS    12
  43.     Xgl_light    xgllgts[MGXGL_MAXLIGHTS]; /* Array of lights */
  44.     int        xglnlights;    /* Number of lights */
  45.     int        xgllgtmask;    /* Bitmask: which of these are on? */
  46.  
  47.     Xgl_trans    xglidentity;    /* Convenient identity transform */
  48.  
  49.             /* Double-buffering state */
  50.     int        membuf;        /* Drawing into (memory) back-buffer */
  51.     int        already;    /* Front buffer already exists */
  52.  
  53.     int        useX11;        /* Using X11 (else XView) */
  54.  
  55.             /* X11 settable values */
  56.     Window    x11win;        /* MG_XWINDOW */
  57.     Display    *x11dpy;    /* MG_XDISPLAY */
  58.     int        x11scrn;    /* MG_XSCREEN */
  59.  
  60.             /* XView settable values */
  61.     Xv_Window    xvwin;        /* XView window structure */
  62.     Frame    frame;        /*  "    frame-window structure */
  63.     Canvas    canvas;        /*  "    canvas */
  64.     int        repaint;    /* MG_REPAINT flag */
  65.     int        resize;        /* MG_RESIZE flag */
  66.     void    (*dorepaint)();    /* MG_REPAINT_PROC callback */
  67.     void    (*doresize)();    /* MG_RESIZE_PROC callback */
  68.  
  69.             /* Misc private data */
  70.     void    *xbuf;        /* General-use buffer for XGL primitive data */
  71.     int        bufsiz;        /* size of malloc'ed xbuf */
  72.     int        bufused;    /* buf pointer -- amount used now */
  73.     void    (*flushfunc)();    /* function to flush buffer [not yet used] */
  74.  
  75.  
  76.             /* mg emulation of stuff XGL really ought to handle */
  77.             /* Not implemented yet (if ever) - 91.09.24 slevy */
  78.     char    weshade;    /* We compute shading, not XGL */
  79.     char    wedither;    /* We (not XGL) dither to approximate colors */
  80.     char    colorindex;    /* Running XGL in colorindex (else RGB) mode */
  81.     Transform    world2cam;    /* World->Camera transform from MGC->cam, */
  82.                 /*  cached for quick access while shading. */
  83.  
  84. } mgxglcontext;
  85.  
  86. #define    MGXGL      ((mgxglcontext *)_mgc)
  87. #define    MGC      _mgc
  88.  
  89.